<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class AssignmentCompletion extends Model
{
    protected $fillable = [
        'assignment_id',
        'student_id',
        'is_completed',
        'completed_at'
    ];

    protected $casts = [
        'is_completed' => 'boolean',
        'completed_at' => 'datetime'
    ];

    public function assignment()
    {
        return $this->belongsTo(Assignment::class);
    }

    public function student()
    {
        return $this->belongsTo(User::class, 'student_id');
    }
}
